#include <bits/stdc++.h>
using namespace std;
const int N=1250;
const int M=120050;
const int INF=0x3f3f3f3f;
int m,n;
struct Edge{
    int v,cap,flow,cost,next;
}edge[M];
int cnt,head[N];
void init(){
    cnt=0;
    memset(head,-1,sizeof(head));
}
void addEdge(int u,int v,int cap,int cost){
    //printf("%d %d %d %d\n",u,v,cap,cost);
    edge[cnt]=Edge{v,cap,0,cost,head[u]};
    head[u]=cnt++;
    edge[cnt]=Edge{u,0,0,-cost,head[v]};
    head[v]=cnt++;
}
int dis[N],pre[N];
bool vis[N];
bool spfa(int s,int t){
    //printf("%d %d\n",s,t);
    queue<int> q;
    for(int i=0;i<N;i++){
        dis[i]=INF;
        vis[i]=false;
        pre[i]=-1;
    }
    dis[s]=0;
    vis[s]=true;
    q.push(s);
    while(!q.empty()){
        int u=q.front();
        q.pop();
        vis[u]=false;
        for(int i=head[u];i!=-1;i=edge[i].next){
            int v=edge[i].v;
            //printf("%d %d\n",u,v);
            int ca=edge[i].cap;
            int co=edge[i].cost;
            int fl=edge[i].flow;
            if(ca>fl && dis[v]>dis[u]+co){
                dis[v]=dis[u]+co;
                pre[v]=i;
                if(!vis[v]){
                    vis[v]=true;
                    q.push(v);
                }
            }
        }
    }
    return dis[t]!=INF;
    //return pre[t]!=-1;
}
void mcmf(int s,int t,int &cost,int &flow){
    cost=0;
    flow=0;
    while(spfa(s,t)){
        int Min=INF;
        for(int i=pre[t];i!=-1;i=pre[edge[i^1].v]){
            Min=min(Min,edge[i].cap-edge[i].flow);
        }
        for(int i=pre[t];i!=-1;i=pre[edge[i^1].v]){
            edge[i].flow+=Min;
            edge[i^1].flow-=Min;
            cost+=edge[i].cost*Min;
        }
        flow+=Min;
    }
}
int tmp[N][N];
int main(void){
    scanf("%d%d",&m,&n);
    init();
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            scanf("%d",&tmp[i][j]);
        }
    }
    int t=n*m+n+1;
    for(int i=1;i<=n*m;i++){
        addEdge(0,i,1,0);
    }
    for(int i=n*m+1;i<=n*m+n;i++){
        addEdge(i,t,1,0);
    }
    for(int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                addEdge((i-1)*n+j,n*m+k,1,tmp[k][i]*j);
            }
        }
    }
    int cost,flow;
    mcmf(0,t,cost,flow);
    printf("%.2lf\n",cost*1.0/m);
    return 0;
}